import PureUserRunnableGroups from '../components/user-runnable-groups';
import * as RunnableGroupAction from 'actions/runnable-group';
import { getFetchStatus } from 'actions/util';
import * as React from 'react';
import * as ReactRedux from 'react-redux';

const mapStateToProps = (state) => {
  return {
    isFetching: getFetchStatus(state, RunnableGroupAction.listByCurrentUser),
    runnableGroups: state.currentUserRunnableGroupList
  };
};

class UserRunnableGroups extends React.Component {
  componentDidMount() {
    this.props.dispatch(RunnableGroupAction.listByCurrentUser());
  }

  render() {
    return <PureUserRunnableGroups {...this.props}/>;
  }
}


export default ReactRedux.connect(mapStateToProps)(UserRunnableGroups);
